const  industry_list = [
    {
       "parent_ind" : "女装",
       "name" : "连衣裙"
    },
    {
       "name": "女装"
    },
    {
       "parent_ind" : "女装",
       "name" : "半身裙"
    },
    {
       "parent_ind" : "女装",
       "name" : "A字裙"
    },
    {
        "parent_ind" : "内存",
         "name": "金士顿"
    },
    {
        "parent_ind" : "金士顿",
         "name": "1234"
    },
    {
       "name": "数码"
    },
    {
      "parent_ind" : "数码",
       "name": "电脑配件"
    },
    {
      "parent_ind" : "电脑配件",
       "name": "内存"
    }, 
    {
        "parent_ind" : "内存",
         "name": "镁光"
    },
  ]

const convert_format = (arr) => {
    let tree = {}
    let note = {}
    let elders = []
    
    const getElders = (father) => {
        if(note.hasOwnProperty(father)) {
            elders.unshift(note[father])
            getElders(note[father])
        }
    }

    const getTree = (obj, elder, count, son) => {
        if (tree.hasOwnProperty(elder) && obj.hasOwnProperty(elder)) {
            obj[elder] = {...tree[elder], ...obj[elder]}
            delete tree[elder]
        } else if (tree.hasOwnProperty(elder)) {
            obj[elder] = {...tree[elder]}
            delete tree[elder]
        }
        console.log(obj, elder, count, son)
        if(count < elders.length - 1) {
            getTree(obj[elder], elders[count + 1], (count + 1), son)
        }else {
            !obj.hasOwnProperty(elder) && (obj[elder] = {})
            obj[elder][son] = {}
        }
    }

    arr.forEach(item => {
        elders = []
        if(item.hasOwnProperty("parent_ind")) {
            note[item.name] = item.parent_ind
            elders.unshift(item.parent_ind)
            getElders(item.parent_ind, item.name)

            if(elders.length === 1) {
                if (!tree.hasOwnProperty(item.parent_ind)) {
                    tree[item.parent_ind] = {}
                }
                tree[item.parent_ind][item.name] = {}
            }else {
                getTree(tree[elders[0]], elders[1], 1, item.name)
            }
        } else {
               !tree.hasOwnProperty(item.name) && (tree[item.name] = {});
        }
    });
    return tree;
}

console.log(convert_format(industry_list));

const data =  {
    "数码": {
      "电脑配件": {
          "内存" : {}
       }
    },
    "女装" : {
       "连衣裙": {},
      "半身裙": {},
      "A字裙": {}
    }
  }